package com.tos.second.controller;

import com.tos.second.common.Result.Result;
import com.tos.second.service.OrdersService;
import com.tos.second.vo.OrdersHistoryVo;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/orders")

@Slf4j
public class OrdersController {

    @Autowired
    private OrdersService ordersService;


    /**
     * 获取历史订单
     * @return
     */
    @GetMapping("/getHistoryOrders")

    public Result<List<OrdersHistoryVo>> getOrdersHistory() {
        log.info("获取历史订单");
        List<OrdersHistoryVo> ordersHistoryVoList = ordersService.getOrdersHistory();
        return Result.success(ordersHistoryVoList);
    }
}
